package gmusic.command;

import gmusic.ma.bo.ArtistMABean;
import gmusic.ma.bo.ReleaseMABean;
import gmusic.ma.services.impl.MetalArchivesServicesImpl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

public class AfficherReleasesMA implements Command {

	private final static Logger log = Logger
			.getLogger(AfficherReleasesMA.class);

	public String execute(HttpServletRequest req) throws Exception {

		HttpSession session = req.getSession();

		long maid = Long.parseLong(req.getParameter("maid"));

		ArtistMABean currentArtist = MetalArchivesServicesImpl.getInstance()
				.getArtist(maid);
		List<ReleaseMABean> releases = MetalArchivesServicesImpl.getInstance()
				.getReleasesAndTracks(maid);

		session.setAttribute("releases", releases);
		session.setAttribute("currentArtist", currentArtist);

		return "/afficherReleasesMA.jsp";
	}
}
